package org.example.jobs;

import cn.hutool.extra.spring.SpringUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.elasticjob.api.ShardingContext;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
import org.example.entity.Test;
import org.example.entity.TestData;
import org.example.service.TestDataService;
import org.example.service.TestJobService;
import org.example.service.TestService;
import org.quartz.DisallowConcurrentExecution;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author yangzhenyu
 * @version 1.0
 * @description:
 * @date 2023/4/26 14:33
 */
@Slf4j
@Component
@DisallowConcurrentExecution
public class TestJobOne implements SimpleJob {
    @Override
    public void execute(ShardingContext context) {
        //作业名称
        String jobName = context.getJobName();
        //分片序列号
        int shardingItem = context.getShardingItem();
        //分片序列号对应的value值
        String shardingParameter = context.getShardingParameter();
        //作业分片总数
        int shardingTotalCount = context.getShardingTotalCount();
        log.info("{} begin, 作业分片总数: {}, 分片序列号: {},分片序列号对应的value值：{}",  jobName,shardingTotalCount, shardingItem,shardingParameter);

    }
}
